<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<xsl:stylesheet 
	version="1.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
	xmlns:msxml="urn:schemas-microsoft-com:xslt"
	xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:CommerceLibrary="urn:CommerceLibrary" xmlns:pm.library="urn:pm.library" 
	exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets CommerceLibrary pm.library ">


<xsl:output method="xml" omit-xml-declaration="yes"/>

<xsl:param name="currentPage"/>

<xsl:variable name="replyMessageId" select="concat('0', umbraco.library:RequestQueryString('id'))" />
<xsl:variable name="replyMessage" select="pm.library:GetPrivateMessage($replyMessageId)[string-length(error) = 0]//privatemessage" />

<xsl:template match="/">
<form action="/private/pmsent.aspx" method="post">
<fieldset>
  <legend>Message Details</legend>
  <br />
  <label for="to">To:</label><br />
  <input type="text" id="to" name="to" class="text">
    <xsl:if test="string-length($replyMessage) &gt; 0">
      <xsl:attribute name="value">
	<xsl:value-of select="umbraco.library:GetMemberName($replyMessage/message/memberid)" />
      </xsl:attribute>
    </xsl:if>
  </input><br />
  <br />
  <label for="subject">Subject:</label><br />
  <input type="text" id="subject" name="subject" class="text">
    <xsl:if test="string-length($replyMessageId) &gt; 0 and string-length($replyMessage) &gt; 0">
      <xsl:attribute name="value">
	<xsl:value-of select="concat('RE: ', $replyMessage/message/subject)" />
      </xsl:attribute>
    </xsl:if>
  </input><br />
  <br />
  <label for="body">Body:</label><br />
  <textarea id="body" name="body">
    <xsl:text>&#10;</xsl:text>
    <xsl:if test="string-length($replyMessageId) &gt; 0 and string-length($replyMessage) &gt; 0">
      <xsl:text>&#10;&#10;--------------------------------------------------&#10;</xsl:text>
      <xsl:value-of select="concat('Sent: ', umbraco.library:FormatDateTime($replyMessage/message/createdate, 'dd MMMM, yyyy'), '&#10;')" />
      <xsl:value-of select="concat('Subject: ', $replyMessage/message/subject, '&#10;')" />
      <xsl:value-of select="concat('Message: ', $replyMessage/message/body, '&#10;')" />
    </xsl:if>
  </textarea><br />
  <br />
  <input type="submit" value="Send" /> [ <a href="/private/pminbox.aspx">CANCEL</a> ]
</fieldset>
</form>
</xsl:template>

</xsl:stylesheet>